package com.lingyuan.product.controller;

import com.lingyuan.common.core.domain.R;
import com.lingyuan.product.domain.CategoryEntity;
import com.lingyuan.product.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName CategoryController
 * @Description 描述
 * @Author guoxin
 * @Date 2024/9/18 10:07
 */
@RestController
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    /**
     * 功能: 获取分类树
     */
    @PostMapping("categoryTree")
    public R categoryTree(){
        List<CategoryEntity> categoryEntityList =  categoryService.categoryTree();
        return R.ok(categoryEntityList);
    }
}
